import mergeConfig from "./utils/mergeConfig.js"


import {
  isFormData
} from "src/utils/type/type.js"

import Http from "./core/Http.js"

import {
  instanceDefaultConfig
} from "./config.js"
import {
  bind
} from "./utils/index.js"

const createHttp = (config) => {
  debugger
  var context = new Http(config);

  var instance = bind(Http.prototype.request, context);
  return instance
}

let http = createHttp(instanceDefaultConfig);

http.Http = Http;

http.create = function(instanceConfig) {
  return createHttp(mergeConfig(http.defaults, instanceConfig))
}

http.cancel = () => {};
http.cancelToken = () => {};


export default http
